As it is generally known, a token bucket is a mechanism that may be used to limit storage input/output (I/O) requests to a maximum rate set by a user. In a system in which a token bucket mechanism is used, when an I/O request is received, it can only be performed if there are sufficient tokens in the token bucket for the resource associated with the request. Otherwise, the request must either be rejected, or queued until the bucket contains a sufficient number of tokens for the request to be performed. For example, in systems in which the maximum rate limit is set by the user in terms of input/output operations per second (IOPS), each token may represent a single input/output operation, and accordingly a received input/output operation will only be performed if there is at least one token in the token bucket. Tokens may also sometimes be referred to as “credits”.
In order to maintain a token bucket system, tokens must be allocated to the token bucket in a way that reflects the maximum rate set by the user.